<?php

namespace addons\helper\controller\wxapp\project;

use addons\helper\controller\wxapp\project\Pbase;
use app\admin\model\Fields;


class Signed extends Pbase
{
    public function _initialize()
    {
        parent::_initialize();
        $this->whereExtend['library_id'] = SIGNED;
        $this->whereExtend['investment_total|tmp_investment_total'] = ['>=', 1];
        $groupIds = $this->getGroupIds();
        $this->library_id = SIGNED;
        // echo $this->library_id ;
        $showAna = true;
        if(/*in_array(GROUP_DISTRICTUNIT,$groupIds) || */in_array(GROUP_STREET,$groupIds) || in_array(GROUP_SOE,$groupIds))
        {
            $chargedep_data = $this->getChargedep();
            if($chargedep_data){
                $chargedep_id = $chargedep_data->chargedep_id;
                $this->whereExtend[] = ['exp',Db::raw("FIND_IN_SET($chargedep_id,chargedep_ids)")];
                // $this->assignconfig('chargedep_id',$chargedep_id);
            }
            $showAna = false;
        }
        if(in_array(GROUP_DISTRICTUNIT,$groupIds) || in_array(GROUP_DISTRICTUNIT,$groupIds))
        {
            $this->whereExtend['is_add'] = 1;
            $this->whereExtend['is_visible'] = 1;
        }
        $this->config['model'] = '签约库';
        $this->config['ruletreeUrl'] = 'project.signed/ruletree';
        $this->config['auth'] =  [
            'add'  => [
                'name' => '添加',
                'url'  => 'project/signed_add',
            ],
            'edit'  => [
                'name' => '编辑',
                'url'  => 'project/edit',
            ],
            'multi' => [
                'del'  => [
                    'name'        => '删除',
                    'color'       => '#e74c3c',
                    'icon'        => 'fa-trash',
                    'url'         => 'auth.admin/del'
                ]
            ],
            'more' => [
                'del'  => [
                    'name'  => '删除',
                    'color' => '#e74c3c',
                    'url'   => 'auth.admin/del'
                ],
            ],
        ];
    }
}